google.setOnLoadCallback(function() {
	initGeoLocation();
});

  
function initGeoLocation() {


	if(geo_position_js.init()){
		geo_position_js.getCurrentPosition(
			function(p) {
				console.log("Got position from geo_position_js: " + p.coords);
				document.forms.myform.lattitude.value = p.coords.latitude;
				document.forms.myform.longitude.value = p.coords.longitude;
			}
			,function(p) {
				// google loader will provide an approximate location 
				// see http://code.google.com/apis/ajax/documentation/#ClientLocation
				// based on the network IP address exposed by the mobile operator gateway
				if (typeof(google.loader.ClientLocation) != 'undefined') {
					try {
						console.log("Got position from google.loader.ClientLocation: " + google.loader.ClientLocation);
						document.forms.myform.lattitude.value =google.loader.ClientLocation.latitude;
						document.forms.myform.longitude.value = google.loader.ClientLocation.longitude;
					} catch (e) {}          
				}
			},
			{enableHighAccuracy:true}
		);


	}
}
